<template>
  <!-- 连续三个月未签单客户 -->
  <el-container>
    <!-- <el-header>
      <div class="left-panel">
        <el-button
          type="primary"
          icon="el-icon-plus"
          @click="add"
          v-auth-button="['add/customerManagement']"
        ></el-button>
      </div>
      <div class="right-panel">
        <div class="right-panel-search">
          <el-input
            v-model="searchValue.search"
            placeholder="客户名称"
            clearable
          ></el-input>
      
          <el-button
            type="primary"
            icon="el-icon-search"
            @click="upsearch"
          ></el-button>
        </div>
      </div>
    </el-header> -->
    <el-main class="nopadding">
      <scTable
        ref="table"
        :apiObj="apiObj"
        row-key="id"
        dataType="listSortBydelete"
        stripe
        @filterType="filterType"
        @row-dblclick="handleRowDblclick"
      >
        <!-- <el-table-column
          fixed
          label="ID"
          prop="id"
          width="60"
        ></el-table-column> -->
        <el-table-column
          fixed
          label="客户名称"
          prop="customerName"
          min-width="300"
        ></el-table-column>
        <el-table-column label="客户类型" prop="customertypeName" width="100">
          <template #default="scope">
            <!-- 1普通客户  2重要客户  -->
            <p v-if="scope.row.customertype == 1">普通客户</p>
            <p v-if="scope.row.customertype == 2">重要客户</p>
          </template>
        </el-table-column>
        <el-table-column label="联系人" prop="firstcontacter" width="100">
        </el-table-column>
        <el-table-column
          label="联系人号码"
          prop="phone"
          width="120"
        ></el-table-column>
        <el-table-column
          label="客户号码"
          prop="telephone"
          width="100"
        ></el-table-column>
        <!-- <el-table-column
          label="邮箱"
          prop="email"
          width="200"
        ></el-table-column> -->
        <el-table-column
          label="地址"
          prop="address"
          min-width="150"
          :show-overflow-tooltip="true"
        ></el-table-column>
        <!-- <el-table-column
          label="支付方式"
          prop="typeName"
          width="150"
        ></el-table-column> -->
        <el-table-column
          label="备注"
          prop="memo"
          min-width="150"
          :show-overflow-tooltip="true"
        ></el-table-column>

        <el-table-column label="操作" fixed="right" align="center" width="220">
          <template #default="scope">
            <el-button-group>
              <el-button
                text
                type="primary"
                size="small"
                @click="table_show(scope.row, scope.$index)"
                >查看</el-button
              >
              <!--        v-auth-button="['show/customerManagement']" -->
            </el-button-group>
          </template>
        </el-table-column>
      </scTable>
    </el-main>
  </el-container>
</template>

<script>

import { queryTypeByDic } from "@/utils/getData"
export default {
  name: "threeMonthNoBill",
  data () {
    return {

      apiObj: this.$API.reportForm.getThreeMonthNoBillList,

      searchValue: {
        search: null,

      },

      userInfo: {},
    }
  },
  mounted () {
    this.userInfo = this.$TOOL.data.get("USER_INFO")

  },
  methods: {

    //查看
    table_show (row) {
      this.$router.push({
        path: "/customer/customerManagement/customerDetail",
        query: {
          id: row.customerId,
        },
      })
    },

    //搜索
    upsearch () {
      this.$refs.table.upData(this.searchValue)
    },



    // 处理支付方式
    filterType (data) {
      let tableData = data
      queryTypeByDic("payment").then((res) => {
        let list = res
        tableData.forEach((item) => {
          list.forEach((t_item) => {
            if (item.paymethod == t_item.value) {
              item.typeName = t_item.name
            }
          })
        })
      })

      queryTypeByDic("customerType").then((res) => {
        let list = res
        tableData.forEach((item) => {
          list.forEach((t_item) => {
            if (item.customertype == t_item.value) {
              item.customertypeName = t_item.name
            }
          })
        })
      })
    },
    // 双击表格
    handleRowDblclick (row) {
      this.table_show(row)
    },
  },
};
</script>

<style>
/* .cellClass {
  cursor: pointer;
} */
</style>
